﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Audio;

public class SoundManager
{

    SoundEffect currentSound;
    SoundEffectInstance currentSoundInstance = null;
    public SoundManager()
    {
    }

    public void playSound(SoundEffect sound, float volume)
    {
        currentSound = sound;
        if (currentSound != null)
        {
            currentSoundInstance = currentSound.Play(volume, 0.0f, 0.0f, true);
        }
    }

    public void playSound(SoundEffect sound, float volume, Boolean loop)
    {
        currentSound = sound;
        if (currentSound != null)
        {
            currentSoundInstance = currentSound.Play(volume, 0.0f, 0.0f, loop);
        }
    }

    public void playOneSoundEffect(SoundEffect sound, float volume)
    {
       
         sound.Play(volume, 0.0f, 0.0f, false);
    }

    public void stopSound()
    {
        if (currentSoundInstance != null)
        {
            currentSoundInstance.Stop(true);
        }
    }
}
